import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/register/user',
            component: () => import('@/components/common/Home.vue'),
            children: [
                // =============================================================================================
                {
                    path: '/register/user',
                    component: () => import('@/components/page/DataPreview/RegisterUser.vue'),
                    meta: {
                        title: '注册用户',
                        requireAuth: true,
                        keepAlive: true
                    },
                    name: 'RegisterUser'
                },
                {
                    path: '/vip/num',
                    component: () => import('@/components/page/DataPreview/VipNum.vue'),
                    name: 'VipNum',
                    meta: {
                        title: '会员数',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/month/vip/num',
                    component: () => import('@/components/page/DataPreview/MonthVipNum.vue'),
                    name: 'MonthVipNum',
                    meta: {
                        title: '包月会员数',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/pay/user/num',
                    component: () => import('@/components/page/DataPreview/PayUserNum.vue'),
                    name: 'PayUserNum',
                    meta: {
                        title: '付费用户数',
                        requireAuth: true,
                        keepAlive: true
                    }
                },

                {
                    path: '/song/buy/ranking',
                    component: () => import('@/components/page/DataPreview/SongBuyRanking.vue'),
                    name: 'SongBuyRanking',
                    meta: {
                        title: '歌曲购买排行',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/album/buy/ranking',
                    component: () => import('@/components/page/DataPreview/AlbumBuyRanking.vue'),
                    name: 'AlbumBuyRanking',
                    meta: {
                        title: '专辑购买排行',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // ===================================用户管理===================================
                // =============================================================================================
                {
                    path: '/user/list',
                    component: () => import('@/components/page/UserManage/UserList.vue'),
                    name: 'UserList',
                    meta: {
                        title: '用户列表',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/user/detail',
                    component: () => import('@/components/page/UserManage/UserList/UserDetail.vue'),
                    name: 'UserDetail',
                    meta: {
                        title: '用户详情',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/blacklist/manage',
                    component: () => import('@/components/page/UserManage/BlackListManage.vue'),
                    name: 'BlackListManage',
                    meta: {
                        title: '黑名单管理',
                        requireAuth: true,
                        keepAlive: true
                    }
                },

                // =============================================================================================
                // ===================================客服管理===================================
                {
                    path: '/feed/back',
                    component: () => import('@/components/page/CustomerWorkOrder/FeedBack.vue'),
                    name: 'FeedBack',
                    meta: {
                        title: '意见反馈',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/userinfo/search',
                    component: () => import('@/components/page/CustomerWorkOrder/UserInfoSearch.vue'),
                    name: 'UserInfoSearch',
                    meta: {
                        title: '用户信息查询',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/product_/set/price',
                    component: () => import('@/components/page/SetPriceManage/ProductSetPrice.vue'),
                    name: 'ProductSetPrice',
                    meta: {
                        title: '产品定价',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/set/product/price',
                    component: () => import('@/components/page/SetPriceManage/ProductSetPrice/SetProductSetPrice.vue'),
                    name: 'SetProductSetPrice',
                    meta: {
                        title: '设置产品价格',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/limit/time/discount',
                    component: () => import('@/components/page/SetPriceManage/SetTimeDiscount.vue'),
                    name: 'SetTimeDiscount',
                    meta: {
                        title: '限时折扣',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/limit/rel/source',
                    component: () => import('@/components/page/SetPriceManage/SetTimeDiscount/RelSource.vue'),
                    name: 'RelSource',
                    meta: {
                        title: '添加关联资源',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/lottery/manage',
                    component: () => import('@/components/page/SetPriceManage/LotteryManage.vue'),
                    name: 'LotteryManage',
                    meta: {
                        title: '抽奖管理',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/integral/get',
                    component: () => import('@/components/page/IntegralManage/IntegralGet.vue'),
                    name: 'IntegralGet',
                    meta: {
                        title: '积分获取',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/integral/add/task',
                    component: () => import('@/components/page/IntegralManage/IntegralGet/AddTask.vue'),
                    name: 'AddTask',
                    meta: {
                        title: '添加&编辑任务',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/integral_/detail',
                    component: () => import('@/components/page/IntegralManage/IntergralDetail.vue'),
                    name: 'IntergralDetail',
                    meta: {
                        title: '积分明细',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/account/manage',
                    component: () => import('@/components/page/AccountManage/AccountManage.vue'),
                    name: 'AccountManage',
                    meta: {
                        title: '账户管理',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/modify/account',
                    component: () => import('@/components/page/AccountManage/AccountManage/ModifyAccount.vue'),
                    name: 'ModifyAccount',
                    meta: {
                        title: '修改账户',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                // {
                //     path: '/role/manage',
                //     component: () => import('@/components/page/AccountManage/RoleManage.vue'),
                //     name: 'RoleManage',
                //     meta: {
                //         title: '角色管理',
                //         requireAuth: true,
                //         keepAlive: true
                //     }
                // },
                {
                    path: '/role_/manage',
                    component: () => import('@/components/page/AccountManage/RoleManage/AuthorManage.vue'),
                    name: 'AuthorManage',
                    meta: {
                        title: '权限管理',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/log/manage',
                    component: () => import('@/components/page/AccountManage/LogManage.vue'),
                    name: 'LogManage',
                    meta: {
                        title: '日志管理',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/customer/work/order',
                    component: () => import('@/components/page/CustomerWorkOrder/CustomerWorkOrder.vue'),
                    name: 'CustomerWorkOrder',
                    meta: {
                        title: '客服管理',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                {
                    path: '/customer/work/order/detail',
                    component: () => import('@/components/page/CustomerWorkOrder/CustomerWorkOrder/WorkOrderDetail.vue'),
                    name: 'WorkOrderDetail',
                    meta: {
                        title: '工单详情',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                // {
                //     path: '/customer/work/order',
                //     component: () => import('@/components/page/CustomerWorkOrder/CustomerWorkOrder.vue'),
                //     meta: { title: '角色-, requireAuth: true,keepAlive: true权限管理' }
                // },
                {
                    path: '/work/order/detail',
                    component: () => import('@/components/page/CustomerWorkOrder/WorkOrderDetail.vue'),
                    name: 'WorkOrderDetail',
                    meta: {
                        title: '工单详情',
                        requireAuth: true,
                        keepAlive: true
                    }
                },
                // =============================================================================================
                {
                    path: '/user_/manage',
                    component: () => import('@/components/page/SysManage/UserManage.vue'),
                    meta: {
                        title: '用户列表',
                        requireAuth: true,
                        keepAlive: true
                    },
                    name: 'UserManage'
                },
                // =============================================================================================
                {
                    path: '/menu/manage',
                    component: () => import('@/components/page/SysManage/MenuManage.vue'),
                    meta: {
                        title: '菜单管理',
                        requireAuth: true,
                        keepAlive: true
                    },
                    name: 'MenuManage'
                },
                // =============================================================================================
                {
                    path: '/role/manage',
                    component: () => import('@/components/page/SysManage/RoleManage.vue'),
                    meta: {
                        title: '角色管理',
                        requireAuth: true,
                        keepAlive: true
                    },
                    name: 'RoleManage'
                },
                // =============================================================================================
                {
                    path: '/depart/manage',
                    component: () => import('@/components/page/SysManage/DepartManage.vue'),
                    meta: {
                        title: '部门管理',
                        requireAuth: true,
                        keepAlive: true
                    },
                    name: 'DepartManage'
                },
            ]
        },

        {
            path: '/login',
            component: () => import('@/components/page/Login/Login.vue'),
            meta: {
                title: '登录',
                requireAuth: false,
                keepAlive: false
            },
            name: 'Login'
        },

    ]
});
